package com.medical.literature.gateway.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.reactive.socket.server.support.WebSocketHandlerAdapter;
import org.springframework.web.reactive.socket.server.upgrade.TomcatRequestUpgradeStrategy;
import org.springframework.web.reactive.socket.server.RequestUpgradeStrategy;

/**
 * WebSocket处理器配置类
 */
@Configuration
public class WebSocketHandlerConfig {

    /**
     * 配置WebSocket处理器适配器
     * @return WebSocket处理器适配器
     */
    @Bean
    public WebSocketHandlerAdapter webSocketHandlerAdapter() {
        return new WebSocketHandlerAdapter();
    }
    
    /**
     * 配置WebSocket服务
     * @return RequestUpgradeStrategy
     */
    @Bean
    public RequestUpgradeStrategy requestUpgradeStrategy() {
        return new TomcatRequestUpgradeStrategy();
    }
}